package ch.usi.swde.hcharts.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import org.moxieapps.gwt.highcharts.client.*;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class HCharts implements EntryPoint {
	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
		final Label pLabel = new Label();
		pLabel.setText("HChart");
		// Add the pLabel to the RootPanel
		// Use RootPanel.get() to get the entire body element
		RootPanel.get("pLabelContainer").add(pLabel);
		// RootPanel.get().add(pLabel);
		
		Chart chart = new Chart()
		   .setType(Series.Type.SPLINE)
		   .setChartTitleText("Lawn Tunnels")
		   .setMarginRight(10);
		
		Series series = chart.createSeries()
				   .setName("Moles per Yard")
				   .setPoints(new Number[] { 163, 203, 276, 408, 547, 729, 628 });
				chart.addSeries(series);
		
		RootPanel.get("chartContainer").add(chart);
		// RootPanel.get().add(chart);
	}
}
